package strategy;
//concrete algorithms
abstract public class StrategyTest {
    abstract public void displayPayment(double bill);
}
//no discount
class Strategy1 extends StrategyTest{
    @Override
    public void displayPayment(double bill) {
        System.out.println("you should pay"+bill);
    }
}
//xx% off
class Strategy2 extends StrategyTest{
    private final double discount;
    Strategy2(double discount){
        this.discount = discount;
    }

    @Override
    public void displayPayment(double bill) {
        System.out.println("you should pay"+bill*discount);
    }
}
//满减
class Strategy3 extends StrategyTest{
    private final int data1;
    private final int data2;
    //满data1，减data2
    Strategy3(int data1, int data2){
        this.data1 = data1;
        this.data2 = data2;
    }

    @Override
    public void displayPayment(double bill) {
        System.out.println("you should pay"+(bill - ((int)bill/data1)*data2));
    }
}